package cn.lili.modules.promotion.client;

import cn.lili.modules.constant.ServiceConstant;
import cn.lili.modules.promotion.entity.dos.Ticket;
import cn.lili.modules.promotion.entity.dos.TicketOrder;
import cn.lili.modules.promotion.fallback.TicketFallback;
import cn.lili.modules.promotion.fallback.TicketOrderFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(path = "${server.servlet.context-path}", name = ServiceConstant.PROMOTION_SERVICE, contextId = "ticket-order", fallback = TicketOrderFallback.class)
public interface TicketOrderClient {

    /**
     * 创建订单
     *
     */
    @PostMapping("/feign/promotion/ticket/order/getTicket")
    void createOrder(@RequestBody TicketOrder ticketOrder);

    /**
     * 修改订单状态
     * @param transactionSn 外部订单号
     * @param orderStatus 订单状态
     */
    @GetMapping("/feign/promotion/ticket/order/updateOrderStatus")
    void updateOrderStatus (@RequestParam String transactionSn, @RequestParam String orderStatus);

    @GetMapping("/feign/promotion/ticket/order/getListByTransactionSn")
    List<TicketOrder> getListByTransactionSn (@RequestParam String transactionSn);
}
